#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "Timer.h"
#include "Encoder.h"

int16_t Speed;

int main(void){
	
	OLED_Init();
	Encoder_Init();
	Timer_Init();//初始化定时器
	OLED_ShowString(1,1,"Speed:");

	
	while(1)
	{
		OLED_ShowSignedNum(1,7,Speed,5);//目前CNT的值就代表速度，单位是脉冲个数/S

	}
}

 
void TIM2_IRQHandler(void)//中断函数
{
	//检查中断标志位
	if(TIM_GetITStatus(TIM2,TIM_IT_Update) == SET)
	{
		Speed =Encoder_Get();
		TIM_ClearITPendingBit(TIM2,TIM_IT_Update);
	}
}
